﻿using Curry.Forum.Infrastructure;
using Curry.Forum.Query.Service.DTOS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Curry.Forum.Query.Service.Dapper
{
    public class HomeQueryService: IHomeQueryService
    {
        private DBHelper _sqlClient = new DBHelper();

        public UserInfo Login(string name,string pwd)
        {
            var model = _sqlClient.Query<UserInfo>(UserInfo.GetSql + "and UserName = @UserName and Password = @Password", new { UserName = name, Password =pwd}).FirstOrDefault();


            if (model == null)
                return null;

            return model;
        }
    }
}
